﻿using System;
using System.Collections.Generic;
using SoftSource.Ria;
using SoftSource.Timecard.Web.Data;

namespace SoftSource.Timecard.Model
{
    public interface IModelEntities : IDisposable
    {
        #region Static
        ReadOnlyEntityWrapper<Role> Roles { get; }
        ReadOnlyEntityWrapper<Report> Reports { get; }
        ReadOnlyEntityWrapper<UserType> UserTypes { get; }
        ReadOnlyEntityWrapper<ProjectType> ProjectTypes { get; }
        ReadOnlyEntityWrapper<RevenueType> RevenueTypes { get; }
        ReadOnlyEntityWrapper<BillingState> BillingStates { get; }
        ReadOnlyEntityWrapper<ProjectStatus> ProjectStatuses { get; }
        ReadOnlyEntityWrapper<BillingFrequency> BillingFrequencies { get; }
        #endregion Static

        #region Read-Only
        ReadOnlyEntityWrapper<UserSummary> UserSummaries { get; }
        ReadOnlyEntityWrapper<ProjectSummary> ProjectSummaries { get; }
        ReadOnlyEntityWrapper<CategorySummary> CategorySummaries { get; }
        ReadOnlyEntityWrapper<CustomerSummary> CustomerSummaries { get; }
        ReadOnlyEntityWrapper<MilestoneSummary> MilestoneSummaries { get; }
        ReadOnlyEntityWrapper<CustomerUserSummary> CustomerUserSummaries { get; }
        ReadOnlyEntityWrapper<ProjectMemberSummary> ProjectMemberSummaries { get; }
        ReadOnlyEntityWrapper<ProjectCategorySummary> ProjectCategorySummaries { get; }
        ReadOnlyEntityWrapper<CustomerProjectSummary> CustomerProjectSummaries { get; }
        #endregion Read-Only

        #region Read-Write
        EntityWrapper<User> Users { get; }
        EntityWrapper<EntryLog> Entries { get; }
        EntityWrapper<Project> Projects { get; }
        EntityWrapper<Customer> Customers { get; }
        EntityWrapper<Category> Categories { get; }
        EntityWrapper<Milestone> Milestones { get; }
        EntityWrapper<CustomerUser> CustomerUsers { get; }
        EntityWrapper<ProjectMember> ProjectMembers { get; }
        EntityWrapper<CustomerProject> CustomerProjects { get; }
        EntityWrapper<ProjectCategory> ProjectCategories { get; }
        EntityWrapper<InvoicingProject> InvoicingProjects { get; }
        #endregion Read-Write     
    }

    public interface IModelQueries
    {
        IObservable<Unit> LoadData();
        IObservable<User> LoadDataForUser(int userID);
        IObservable<Project> LoadDataForProject(int projectID);
        IObservable<DateTime> GetProjectCreationDate(int projectID);
        IObservable<IEnumerable<LastEntry>> GetLatestEntries();
        IObservable<IEnumerable<EntryLog>> GetFlaggedEntries();
        IObservable<IEnumerable<EntryLog>> GetEntriesPastProjectDueDate();
        IObservable<IEnumerable<EntryLog>> GetEntriesPriorToLastBillingDate();
        IObservable<IEnumerable<ProjectSummary>> GetProjectsWithInvalidManagers();
        IObservable<IEnumerable<ProjectMember>> GetProjectMembersForUser(int userID);
        IObservable<IEnumerable<EntrySummary>> GetUtilizationSummaries(DateTime startDate, DateTime endDate);
        IObservable<IEnumerable<EntryLog>> MarkEntriesAsBilled(int projectID, DateTime? startDate, DateTime endDate);
        IObservable<Unit> SendReminders(
            string password,
            IEnumerable<int> userIDs,
            string message);
        IObservable<Unit> SendEmail(
            string password,
            IEnumerable<int> toUserIDs,
            IEnumerable<int> ccUserIDs,
            string subject,
            string message,
            bool seperateToAddresses);
        IObservable<IEnumerable<EntryLog>> GetFilteredEntries(
            int? projectID,
            int? userID,
            DateTime? startDate,
            DateTime? endDate);
    }

    public interface IModel : IModelEntities, IModelQueries
    {
    }
}
